from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait

# 打开浏览器
from urllib3.util import wait

path = r"D:\chromedriver-win64\chromedriver.exe" # 定义驱动路径
driver = webdriver.Chrome(executable_path=path)
# 2.输入访问地址
# driver.get("http://121.43.169.97:8848/pageA.html")
# 放大浏览器
driver.maximize_window()

# 实例化WebDriverWait，并调用until(method)方法
# 1). driver：浏览器驱动对象
# 2). timeout：超时的时长，单位：秒
# 3). poll_frequency：检测间隔时间，默认为0.5秒
# 显示等待
wait = WebDriverWait(driver, 10, 1)
username = wait.until(lambda x: x.find_element_by_css_selector("userA"))
username.send_keys("admin")

sleep(3)
driver.quit()